<template>
  <div id="app">
    {{ $store.state.count }}
    <button @click="add">加1</button>
    <button @click="reduce">减1</button>
    <hr>
    <HelloWorld />
  </div>
</template>
<script>
import HelloWorld from './components/HelloWorld'
export default {
  components: {
    HelloWorld
  },
  mounted () {
    console.log(this.$store)
  },
  methods: {
    add () {
      // 显示提交mutation
      this.$store.commit('updateCount', this.$store.state.count + 1)
    },
    reduce () {
      // 显示提交mutation
      this.$store.commit('updateCount', this.$store.state.count - 1)
    }
  }
}
</script>
